package com.eb.buybuybuy.util;

import com.eb.buybuybuy.init.Init;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesUtil {
    private static Properties properties = new Properties();

    static {
        try {
            InputStream inputStream = Init.class.getClassLoader().getResourceAsStream("application.properties");
            if (inputStream == null) {
                System.out.println("未找到配置文件");
            }
            properties.load(inputStream);
        } catch (IOException e) {
            System.out.println("读取配置文件错误");
        }
    }

    public static String get(String key) {
        return properties.get(key).toString();
    }

    public static String[] getArray(String key) {
        String string = properties.get(key).toString();
        return string.split(" | ");
    }
}
